//
//  Order_class_cell.m
//  pmmSS
//
//  Created by Mac book on 2017/9/20.
//  Copyright © 2017年 WTFSSD. All rights reserved.
//

#import "Order_class_cell.h"

@interface Order_class_cell()

@property (nonatomic,strong) UILabel *header_orderIcon_Label;

@property (nonatomic,strong) UILabel *header_orderStatus_Label;

@property (nonatomic,strong) UIView *detail_BgView;

@property (nonatomic,strong) UIImageView *detail_iconimageView;

@property (nonatomic,strong) UILabel *detail_title_Label;

@property (nonatomic,strong) UILabel *detail_commodityNumber_Label;

@property (nonatomic,strong) UILabel *detail_orderPrice_Label;

@property (nonatomic,strong) UIView *detail_lineView;

@property (nonatomic,strong) UIButton *footer_buttonOne;

@property (nonatomic,strong) UIButton *footer_buttonTwo;

@end

@implementation Order_class_cell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{


    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self  initSubViews];
    }

    return self;
}

-(void)initSubViews{

    WeakSelf(weakSelf);


    // TODO: 订单号
    _header_orderIcon_Label  = [HMLabel createLabelWithText:@"订单号：654638796788" andTextColor:RGBA(51,51,51,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(12)] andTextAlignment:NSTextAlignmentLeft];

    [self.contentView addSubview:_header_orderIcon_Label];

    [_header_orderIcon_Label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(autoScaleH(10));
        make.left.mas_equalTo(autoScaleW(10));

        make.height.mas_equalTo(autoScaleH(17));

        make.width.mas_equalTo(autoScaleW(200));

    }];

    // TODO: 订单状态
    _header_orderStatus_Label  = [HMLabel createLabelWithText:@"待收货" andTextColor:RGBA(242,48,47,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(13)] andTextAlignment:NSTextAlignmentRight];

    [self.contentView addSubview:_header_orderStatus_Label];

    [_header_orderStatus_Label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(autoScaleH(10));
        make.right.mas_equalTo(autoScaleW(-20));

        make.height.mas_equalTo(autoScaleH(17));

        make.width.mas_equalTo(autoScaleW(50));
        
    }];

    // TODO: 详情背景
    _detail_BgView = [[UIView alloc] init];

    _detail_BgView.backgroundColor = RGBA(250, 250, 250, 1);

    [self.contentView addSubview:_detail_BgView ];

    [_detail_BgView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(weakSelf.header_orderIcon_Label.mas_bottom).offset(autoScaleH(10));
        make.right.mas_equalTo(0);

        make.height.mas_equalTo(autoScaleH(90));

        make.left.mas_equalTo(0);


    }];

    // TODO: 商品缩略图片

    _detail_iconimageView  = [[UIImageView alloc]init];
    [_detail_iconimageView setImage:[UIImage imageNamed:@"list_icon_shop"]];
    [self.detail_BgView addSubview:_detail_iconimageView];

    [_detail_iconimageView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(autoScaleH(5));
        make.left.mas_equalTo(autoScaleW(10));
        make.height.mas_equalTo(autoScaleH(78));
        make.width.mas_equalTo(autoScaleW(75));

    }];

    // TODO: 商品标题

    _detail_title_Label  = [HMLabel createLabelWithText:@"304不锈钢棒 直条 不锈钢 304不锈钢棒 直条 不锈钢" andTextColor:RGBA(51,51,51,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(13)] andTextAlignment:NSTextAlignmentLeft];
    _detail_title_Label.numberOfLines = 2 ;

    [self.detail_BgView addSubview:_detail_title_Label];

    [_detail_title_Label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(autoScaleH(10));
        make.left.mas_equalTo(autoScaleW(100));
        make.height.mas_equalTo(autoScaleH(50));
        make.right.mas_equalTo(autoScaleW(-20));
        
    }];

    // TODO: 商品 数量
    _detail_commodityNumber_Label  = [HMLabel createLabelWithText:@"×6" andTextColor:RGBA(153,153,153,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(13)] andTextAlignment:NSTextAlignmentRight];

    [self.detail_BgView addSubview:_detail_commodityNumber_Label];

    [_detail_commodityNumber_Label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.bottom.mas_equalTo(autoScaleH(-10));
        make.width.mas_equalTo(autoScaleW(100));
        make.height.mas_equalTo(autoScaleH(20));
        make.right.mas_equalTo(autoScaleW(-25));
        
    }];


    // TODO: 商品价格
    _detail_orderPrice_Label  = [HMLabel createLabelWithText:@"共6件商品 合计：￥6688" andTextColor:RGBA(51,51,51,1) andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(13)] andTextAlignment:NSTextAlignmentRight];

    [self.contentView addSubview:_detail_orderPrice_Label];

    [_detail_orderPrice_Label mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(weakSelf.detail_BgView.mas_bottom).offset(autoScaleH(10));
        make.right.mas_equalTo(autoScaleW(-20));

        make.height.mas_equalTo(autoScaleH(17));

        make.width.mas_equalTo(autoScaleW(200));
        
    }];
    // TODO: 阴影线
    _detail_lineView = [[UIView alloc] init];

    _detail_lineView.backgroundColor = RGBA(208, 208, 208, 1);

    [self.contentView addSubview:_detail_lineView ];

    [_detail_lineView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(weakSelf.detail_orderPrice_Label.mas_bottom).offset(autoScaleH(10));
        make.right.mas_equalTo(0);

        make.height.mas_equalTo(autoScaleH(0.5));

        make.left.mas_equalTo(0);
        
        
    }];



     // TODO: 底部按钮 01
    _footer_buttonOne = [HMButton createButtonWithTitle:@"按钮01" andTitleColor:RGBA(242,48,47,1) andBgColor:nil andImage:nil andBgImage:nil andSelecter:@selector(clickButton:) andTarget:self andTag:101];

    _footer_buttonOne.clipsToBounds = YES;
    _footer_buttonOne.layer.cornerRadius = autoScaleH(13);
    _footer_buttonOne.layer.borderWidth = 0.5;
    _footer_buttonOne.layer.borderColor = RGBA(242,48,47,1).CGColor;


    _footer_buttonOne.titleLabel.font = [UIFont fontWithName:default_fontname size:autoScaleW(12)];

    [self.contentView addSubview:_footer_buttonOne];

    [_footer_buttonOne mas_makeConstraints:^(MASConstraintMaker *make) {

        make.bottom.mas_equalTo(autoScaleH(-10));
        make.right.mas_equalTo(autoScaleW(-20));
        make.width.mas_equalTo(autoScaleW(75));
        make.height.mas_equalTo(autoScaleH(27));

    }];

    _footer_buttonTwo = [HMButton createButtonWithTitle:@"按钮02" andTitleColor:RGBA(51, 51, 51, 1) andBgColor:nil andImage:nil andBgImage:nil andSelecter:@selector(clickButton:) andTarget:self andTag:102];

    _footer_buttonTwo.clipsToBounds = YES;
    _footer_buttonTwo.layer.cornerRadius = autoScaleH(13);
    _footer_buttonTwo.layer.borderWidth = 0.5;
    _footer_buttonTwo.layer.borderColor = RGBA(150, 150, 150, 1).CGColor;


    _footer_buttonTwo.titleLabel.font = [UIFont fontWithName:default_fontname size:autoScaleW(12)];

    [self.contentView addSubview:_footer_buttonTwo];

    [_footer_buttonTwo mas_makeConstraints:^(MASConstraintMaker *make) {

        make.bottom.mas_equalTo(autoScaleH(-10));
        make.right.mas_equalTo(weakSelf.footer_buttonOne.mas_left).offset(autoScaleW(-20));
        make.width.mas_equalTo(autoScaleW(75));
        make.height.mas_equalTo(autoScaleH(27));
        
    }];

}

-(void)clickButton:(UIButton *)button{


    [self.delegate passButtonTag:button.tag];


    switch (button.tag) {
        case 101:
        {

        }
            break;

        case 102:
        {

        }
            break;

            
        default:
            break;
    }

}
@end
